<?php 
include"dom/simple_html_dom.php";
$con = mysqli_connect("localhost","quraqabb_hadith","J99mqHENk}N.","quraqabb_hadith");
$websiteURL = "https://sunnah.com/bukhari/2";
$html = file_get_html($websiteURL);
$numcounter = count($dot2 = $html->find('.englishchapter'));
$arnumcounter = count($dot2 = $html->find('.arabicchapter '));
echo "Number of elements are ".$numcounter;
echo "Number of elements are ".$arnumcounter;
echo "<br>";echo "<br>";

$x=0;
while ($x < $numcounter) {
 	$content = $html->find('.englishchapter',$x)->plaintext; 
	$cont = mysqli_escape_string($con,$content);
	echo "<pre>";
	echo $x." ".$cont;
	echo "</pre>";
	
	$arcontent = $html->find('.arabicchapter',$x)->plaintext; 
	$arcont = mysqli_escape_string($con,$arcontent);
	echo "<pre>";
	echo $x." ".$arcont;
	echo "</pre>";
	
	$sumcontent = $html->find('.english_hadith_full',$x)->plaintext; 
	$sumcont = mysqli_escape_string($con,$sumcontent);
	echo "<pre>";
	echo $x." ".$sumcont;
	echo "</pre>";
	$x++;
}


?>